#ifndef __LIGHT_TOOLS_H__
#define __LIGHT_TOOLS_H__

#ifdef __cplusplus
extern "C"
{
#endif

#include "tuya_cloud_types.h"
#include "app_light_control.h"

/**
 * @note This function shows how to transfor zigbee bright and temperature to app data
 * @param[in] {UCHAR_T} zig_b
 * @param[in] {USHORT_T} zig_t
 * @param[out] {USHORT_T} app_b
 * @param[out] {USHORT_T} app_t
 * @return none
 */
VOID_T app_light_tools_zig_bt_2_app_bt(UCHAR_T zig_b, USHORT_T zig_t, USHORT_T *app_b, USHORT_T *app_t);

/**
 * @note This function shows how to transfor app data to zigbee data
 * @param[in] {USHORT_T} app_b
 * @param[in] {USHORT_T} app_t
 * @param[out] {UCHAR_T} zig_b
 * @param[out] {USHORT_T} zig_t
 * @return none
 */
VOID_T app_light_tools_bt_2_zig_bt(UCHAR_T *zig_b, USHORT_T *zig_t, USHORT_T app_b, USHORT_T app_t);

/**
 * @note: ASSIC change to hex
 * @param [in] { UCHAR_T AscCode -> ASSIC code }
 * @return: hex value
 */
UCHAR_T app_light_tools_asc2hex(IN UCHAR_T AscCode);

/**
 * @note: four UCHAR_T merge into USHORT_T
 * @param [in] { UCHAR_T HH -> USHORT Hight hight 4bit }
 * @param [in] { UCHAR_T HL -> USHORT Hight low 4bit   }
 * @param [in] { UCHAR_T LH -> USHORT low hight 4bit   }
 * @param [in] { UCHAR_T LL -> USHORT low low 4bit     }
 * @return: USHORT value
 */
USHORT_T app_light_tools_str2short(UCHAR_T HH, UCHAR_T HL, UCHAR_T LH, UCHAR_T LL);

/**
 * @berief: get the max value in 5 numbers
 * @param { ULONG_T a -> number1 }
 * @param { ULONG_T b -> number2 }
 * @param { ULONG_T c -> number3 }
 * @param { ULONG_T d -> number4 }
 * @param { ULONG_T e -> number5 }
 * @return: Max value
 * @retval: none
 */
ULONG_T app_light_tools_get_max_value(ULONG_T a, ULONG_T b, ULONG_T c, ULONG_T d, ULONG_T e);

/**
 * @berief: get the absolute value
 * @param { LONG_T value -> calc value }
 * @return: absolute value
 * @retval: none
 */
ULONG_T app_light_tools_get_abs_value(LONG_T value);

/**
 * @brief 
 * 
 * @param zig_b 
 * @return USHORT_T 
 */
USHORT_T app_light_tools_zig_b_2_app_B(UCHAR_T zig_b);

/**
 * @brief 
 * 
 * @param app_B 
 * @return UCHAR_T 
 */
UCHAR_T app_light_tools_B_2_zig_b(USHORT_T app_B);

/**
 * @brief 
 * 
 * @param zigbee_t 
 * @return USHORT_T 
 */
USHORT_T app_light_tools_zig_t_2_app_t(USHORT_T zigbee_t);

/**
 * @brief 
 * 
 * @param app_t 
 * @return USHORT_T 
 */
USHORT_T app_light_tools_t_2_zig_t(USHORT_T app_t);


#ifdef __cplusplus
}
#endif

#endif